<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%-- 
    Document   : editMatch.jsp
    Created on : 28.4.2011, 14:15:10
    Author     : Football-Statistics Team
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>

<f:setLocale value="${pageContext.request.locale}"/>
<f:setBundle basename="labelsBundle" />

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title><f:message key="project_title" /></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script type="text/javascript" src="../js/addHTMLControls.js"></script>
        <link rel="stylesheet" href="../css/admin.css" />
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
        <script type="text/javascript" src="../js/adminmenu.js"></script>
    </head>
    <body onload="loadVars()">
         <%@include file="adminmenu.jsp" %>  
         <h2><f:message key="edit_match"/></h2>
        <c:import url="XSLT/leagueSelect.xsl" var="xslt"/>
        <f:message key="select_season" var="select_season"/>
        <div class="box">
            <label><f:message key="select_season"/>:</label>
            <x:transform xml="${xml_leagues}" xslt="${xslt}">
                <x:param name="select_season" value="${select_season}"/>
                <x:param name="lid" value="${lid}"/>
                <x:param name="redirect" value="${pageContext.request.contextPath}/administration?section=matches&lid="/> 
            </x:transform>
        </div>
        <ul id="nav">
            <li><a href="${pageContext.request.contextPath}/administration/add-match?lid=${lid}" target="_self"><f:message key="add_match" /></a></li> 
            <li><a href="${pageContext.request.contextPath}/administration/remove-match?lid=${lid}" target="_self"><f:message key="remove_match" /></a></li>
            <li><a href="${pageContext.request.contextPath}/administration/edit-match?lid=${lid}" target="_self"><f:message key="edit_match" /></a></li>
        </ul>
        <c:if test="${not empty error}">
            <div class="error">
                <c:out value="${error}"/>
            </div>
        </c:if>
        <c:if test="${not empty success}">
            <div class="success">
                <c:out value="${success}"/>
            </div>
        </c:if>
        <c:if test="${not empty xml_matches}">
            <c:import url="XSLT/matchSelect.xsl" var="xslt"/>
            <f:message key="select_match" var="select_match"/>
            <div class="box">
                <label><f:message key="select_match"/>: </label>
                <x:transform xml="${xml_matches}" xslt="${xslt}">
                    <x:param name="select_match" value="${select_match}"/>
                    <x:param name="mid" value="${mid}"/>
                    <x:param name="redirect" value="${pageContext.request.contextPath}/administration/edit-match?lid=${lid}&mid="/>
                </x:transform>
            </div>
            <c:if test="${not empty xml_match and not empty mid}">
                <form action="${pageContext.request.contextPath}/administration/edit-match" method="post">
                    <c:import url="XSLT/editMatch.xsl" var="xslt"/>
                    <f:message key="league" var="league"/>
                    <f:message key="season" var="season"/>
                    <f:message key="date" var="date"/>
                    <f:message key="time" var="time"/>
                    <f:message key="round" var="round"/>
                    <f:message key="goals" var="goals"/>
                    <f:message key="cards" var="cards"/>
                    <f:message key="changes" var="changes"/>
                    <f:message key="players" var="players"/>
                    <f:message key="stadium" var="stadium"/>
                    <f:message key="referee" var="referee"/>
                    <f:message key="spectators" var="spectators"/>
                    <f:message key="home" var="home"/>
                    <f:message key="guests" var="guests"/>
                    <f:message key="score" var="score"/>
                    <x:transform xml="${xml_match}" xslt="${xslt}">
                        <x:param name="url" value="${pageContext.request.contextPath}"/>
                        <x:param name="league" value="${league}" />
                        <x:param name="season" value="${season}" />
                        <x:param name="date" value="${date}" />
                        <x:param name="time" value="${time}" />
                        <x:param name="round" value="${round}" />
                        <x:param name="goals" value="${goals}" />
                        <x:param name="cards" value="${cards}" />
                        <x:param name="changes" value="${changes}" />
                        <x:param name="players" value="${players}" />
                        <x:param name="stadium" value="${stadium}" />
                        <x:param name="referee" value="${referee}" />
                        <x:param name="spectators" value="${spectators}" />
                        <x:param name="home" value="${home}" />
                        <x:param name="guests" value="${guests}" />
                        <x:param name="score" value="${score}" />
                    </x:transform>
                    <input type="hidden" name="lid" value="${lid}"/>
                    <input type="hidden" name="mid" value="${mid}"/>
                    <f:message key="edit_match" var="edit"/>
                    <input id="button" type="submit" value="${edit}"/>
                </form>
            </c:if>
        </c:if>
    </body>
</html>
